package cn.itcast.producer;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 工作队列消息生产者
 *
 * @author lee.siu.wah
 * @version 1.0
 * <p>File Created at 2020-11-24<p>
 */
@Component
public class WorkProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;
    @Resource
    private AmqpTemplate amqpTemplate;

    // 生产消息方法
    public void sendMessage(){
        /**
         * String exchange 交换机
         * String routingKey 路由键
         * Object message 消息内容
         */
        rabbitTemplate.convertAndSend("", "work-queue", "工作队列模式的消息内容！");

    }
}
